home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGMISC
/
PCSSP.LZH
/
PC-SSP.ZIP
/
POLYSPTP.ZIP
/
DLEPS.FOR
< prev
next >
Wrap
Text File
|
1985-11-29
|
2KB
|
62 lines
C
C ..................................................................
C
C SUBROUTINE DLEPS
C
C PURPOSE
C COMPUTES THE VALUE OF AN N-TERM EXPANSION IN LEGENDRE
C POLYNOMIALS WITH COEFFICIENT VECTOR C FOR ARGUMENT VALUE X.
C
C USAGE
C CALL DLEPS(Y,X,C,N)
C
C DESCRIPTION OF PARAMETERS
C Y - RESULT VALUE
C DOUBLE PRECISION VARIABLE
C X - ARGUMENT VALUE
C DOUBLE PRECISION VARIABLE
C C - COEFFICIENT VECTOR OF GIVEN EXPANSION
C COEFFICIENTS ARE ORDERED FROM LOW TO HIGH
C DOUBLE PRECISION VECTOR
C N - DIMENSION OF COEFFICIENT VECTOR C
C
C REMARKS
C OPERATION IS BYPASSED IN CASE N LESS THAN 1
C
C SUBROUTINES AND FUNCTION SUBPROGRAMS REQUIRED
C NONE
C
C METHOD
C DEFINITION
C Y=SUM(C(I)*P(I-1,X), SUMMED OVER I FROM 1 TO N).
C EVALUATION IS DONE BY MEANS OF UPWARD RECURSION
C USING THE RECURRENCE EQUATION FOR LEGENDRE POLYNOMIALS
C P(N+1,X)=2*X*P(N,X)-P(N-1,X)-(X*P(N,X)-P(N-1,X))/(N+1).
C
C ..................................................................
C
SUBROUTINE DLEPS(Y,X,C,N)
C
DIMENSION C(1)
DOUBLE PRECISION C,Y,X,H0,H1,H2
C
C TEST OF DIMENSION
IF(N)1,1,2
1 RETURN
C
2 Y=C(1)
IF(N-2)1,3,3
C
C INITIALIZATION
3 H0=1.D0
H1=X
C
DO 4 I=2,N
H2=X*H1
H2=H2-H0+H2-(H2-H0)/DFLOAT(I)
H0=H1
H1=H2
4 Y=Y+C(I)*H0
RETURN
END